package TwoPointers;

public class _11_ContainerWithMostWater {
    public int maxArea(int[] height) {
        int area = Integer.MIN_VALUE;
        int begin = 0, end = height.length - 1;
        int lmax = 0,rmax = 0;
        while (begin <= end) {
            if (height[begin] <= height[end]) {
                area = Math.max(area, (end - begin) * height[begin++]);
            } else {
                area = Math.max(area, (end - begin) * height[end--]);
            }
        }
        return area;
    }
}
